import React, { Component, Fragment } from 'react';
import { Card, Button, message } from 'antd';
import './ui.less';

export default class Messages extends Component {
  handleMessage(type) {
    message[type](type, 2.5, () => {
      console.log(type);
    });
  }

  render() {
    return (
      <Fragment>
        <Card title="全局提示框" className="card-wrap">
          <Button onClick={() => this.handleMessage('info')}>info</Button>
          <Button type="primary" onClick={() => this.handleMessage('success')}>
            success
          </Button>
          <Button type="primary" onClick={() => this.handleMessage('loading')}>
            loading
          </Button>
          <Button type="dashed" onClick={() => this.handleMessage('warn')}>
            warn
          </Button>
          <Button type="danger" onClick={() => this.handleMessage('error')}>
            error
          </Button>
        </Card>
      </Fragment>
    );
  }
}
